home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Very Best of Atari Inside
/
The Very Best of Atari Inside 1.iso
/
mint
/
mntlib43
/
mntlib
/
strchr.c
< prev
next >
Wrap
C/C++ Source or Header
|
1993-05-23
|
646b
|
34 lines
/* from Henry Spencer's stringlib */
/* modified by ERS */
#include <string.h>
/*
* strchr - find first occurrence of a character in a string
*/
#ifdef __GNUC__
asm(".stabs \"_index\",5,0,0,_strchr"); /* dept of clean tricks */
#else
char *
index(s, charwanted)
const char *s;
int charwanted;
{
return strchr(s, charwanted);
}
#endif
char * /* found char, or NULL if none */
strchr(s, charwanted)
const char *s;
register int charwanted;
{
register char c;
/*
* The odd placement of the two tests is so NUL is findable.
*/
while ((c = *s++) != (char) charwanted)
if (c == 0) return NULL;
return((char *)--s);
}